Skip to content

Add an API for CRUD operations on collections#86

Merged
joachimvh merged 5 commits intomainfrom
collections
Apr 21, 2026
Merged

Add an API for CRUD operations on collections#86
joachimvh merged 5 commits intomainfrom
collections

Conversation

@joachimvh
Copy link
Copy Markdown
Contributor

My suggestion for a Collection API. The documentation file describes how it works. It works similar to the policy API as in that a GET to the root returns information on all collections you can modify, POST to the root for new collections, etc. PATCH is not supported, only PUT to replace a collection.

You can only create an asset collection over resources you are the owner of.

You can only create a party collection if you put yourself as one of the owners (that can modify this collection).

Automatically generated collections, through relations, can be read but not modified.

Example JSON bodies for the POST request:

{
  "description": "My assets",
  "type": "asset",
  "parts": [ "http://example.com/alice/", "http://example.com/alice/README" ],
}
{
  "description": "My party",
  "type": "party",
  "owners": [ "http://example.com/alice/profile/card#me" ],
  "parts": [ "http://example.com/alice/profile/card#me", "http://example.com/bob/profile/card#me" ],
}

A corresponding response to the GET request would then be something like

@prefix dc: <http://purl.org/dc/terms/>.
@prefix odrl: <http://www.w3.org/ns/odrl/2/>.

<http://example.com/collections/123456> a odrl:AssetCollection ;
  dc:description "My assets" ;
  dc:creator <http://example.com/alice/profile/card#me> .
<http://example.com/alice/> odrl:partOf <http://example.com/collections/123456> .
<http://example.com/alice/README> odrl:partOf <http://example.com/collections/123456> .

<http://example.com/collections/654321> a odrl:PartyCollection ;
  dc:description "My party" ;
  dc:creator <http://example.com/alice/profile/card#me> .
<http://example.com/alice/profile/card#me> odrl:partOf <http://example.com/collections/654321> .
<http://example.com/bob/profile/card#me> odrl:partOf <http://example.com/collections/654321> .

@joachimvh joachimvh merged commit 5ed6150 into main Apr 21, 2026
6 checks passed
@joachimvh joachimvh deleted the collections branch April 21, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant